﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace HealthcareSystem.API.Write.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ImagesController : ControllerBase
    {
        [HttpPost]
        public IActionResult  img(IFormFile file)
        {
            var list = Directory.GetCurrentDirectory() + @"/wwwroot/Images/" + file.FileName;
            using (FileStream fs =new FileStream(list, FileMode.Create))
            {
                file.CopyTo(fs);
                fs.Close();
            }

            return Ok("http://localhost:5203/Images/"+file.FileName);
        }
    }
}
